home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / efun / next_bit < prev    next >
Text File  |  2001-04-06  |  1KB  |  32 lines

  1. SYNOPSIS
  2.         int next_bit (string str, int start)
  3.         int next_bit (string str, int start, int find_cleared)
  4.  
  5. DESCRIPTION
  6.         Return the number of the next bit in bitstring <str> after position
  7.         <start>. Usually this is the next set bit, but if <find_cleared>
  8.         is given and not 0, the position of the next cleared bit is returned.
  9.  
  10.         Note that finding cleared bits after the last set bit is limited to
  11.         the actual length of <str>.
  12.  
  13.         Each character contains 6 bits. So you can store a value
  14.         between 0 and 63 in one character (2^6=64). Starting character
  15.         is the blank " " which has the value 0. The first character in
  16.         the string is the one with the lowest bits (0-5).
  17.  
  18. EXAMPLES
  19.         string s;
  20.         int p;
  21.  
  22.         s = set_bit("", 4); s = set_bit(s, 2);
  23.  
  24.         for (p = -1; -1 != (p = next_bit(s, p); )
  25.             write(p+"\n");
  26.  
  27.         --> will write 2 and 4
  28.  
  29. SEE ALSO
  30.         set_bit(E), clear_bit(E), test_bit(E), last_bit(E), count_bits(E),
  31.         and_bits(E), or_bits(E), xor_bits(E), invert_bits(E)
  32.